package com.qf.controller.userinfocontroller;

import com.qf.entity.User;
import com.qf.entity.userfamilyinfo.UserVO;
import com.qf.service.userfamilyservice.UserFamilyInfoService;
import com.qf.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * --- 今日无事,勾栏听曲 ---
 *
 * @author JinZhiHao
 * @date 2024/12/4
 * @desc
 */


@RestController
@RequestMapping("/user/family")
public class UserFamilyInfoController {

    @Autowired
    private UserFamilyInfoService userFamilyInfoService;

    @GetMapping("/getFamilyInfo")
    public R findUserFamilyInfo(String username){
        List<UserVO> list = userFamilyInfoService.findUserFamilyInfo(username);
        System.out.println("list ==============> " + list);
        return R.ok(list);
    }

    /**
     * 编辑家庭档案信息
     */
    @PostMapping("/editFamilyInfo")
    public R editUserFamilyInfo(@RequestBody UserVO userVO) {
        boolean isOk = userFamilyInfoService.editUserFamilyInfo(userVO);
        return R.ok(isOk);
    }
}
